package org.example.config;

import org.example.MyKafkaProducer;
import org.example.producer.LocalKafkaProducer;

/**
 *
 * @author youshang
 * @date 2021/02/09 18:03
 **/
public class LocalKafkaTemplate   {

    String topic;
    Object messageKey;
    Object messageValue;


    public void send(String topic,Object messageKey,Object messageValue){
        this.topic = topic;
        this.messageKey = messageKey;
        this.messageValue = messageValue;
        LocalKafkaProducer localKafkaProducer = new LocalKafkaProducer();
        producer(localKafkaProducer);
    }

    public void producer(MyKafkaProducer producer){
        producer.send(topic,messageKey,messageValue);
    }

}
